Add rtrim to trim those scanf'ed things with all the trailing whitespace.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 14 Nov 2002 05:16:05 +0000 (05:16 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 14 Nov 2002 05:16:05 +0000 (05:16 +0000)
csv_stringtrim isn't quite what we need...

gpsbabel/gpsutil.c
gpsbabel/util.c

index 6d0dc3e28f8203c2bc4a493cb14ccf0c0ccf6184..42fb4dbb9ed261bc0906d916665c63c98aff7920 100644 (file)
@@ -55,6 +55,7 @@ data_read(void)
        while( fscanf(file_in, "%s %le%c %le%c %ld%c %30[^,] %c",
                        name, &lat, &latdir, &lon, &londir,
                        &alt, &alttype, desc, icon) > 0) {
+               rtrim(desc);
                wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
                wpt_tmp->position.altitude.altitude_meters = alt;
                wpt_tmp->shortname = xstrdup(name);
index 190920290e8e3604582ca50def37728802f1dcfd..2a581c74fc6957d7301e9c3de7280995a12d6488 100644 (file)
@@ -59,6 +59,23 @@ xstrdup(const char *s)
        return o;
 }
 
+void *
+rtrim(char *s)
+{
+       char *p;
+
+       while (*s) {
+               s++;
+       }
+
+       s--;
+       while (isspace (*s)) {
+               *s = 0;
+               s--;
+       }
+
+}
+
 
 coord
 mkposn(const char *string)